<template>
  <div class="traffic-detail-demo">
    <div class="demo-header">
      <h1>流量详情监控界面优化演示</h1>
      <p>使用进度条直观展示数据使用情况，配色方案使用对比色文字</p>
    </div>
    
    <div class="demo-content">
      <!-- 跳点和免流概览 -->
      <div class="mobile-overview-cards">
        <div class="mobile-stat-card jump-card">
          <div class="mobile-stat-value jump">128.5MB</div>
          <div class="mobile-stat-label">跳点</div>
        </div>
        <div class="mobile-stat-card free-card">
          <div class="mobile-stat-value free">15.6MB</div>
          <div class="mobile-stat-label">免流</div>
        </div>
      </div>

      <!-- 时间信息 -->
      <div class="time-info-card">
        <div class="time-diff-info">
          距离上次时间: 30分钟
        </div>
      </div>

      <!-- 本次流量进度条 -->
      <div class="mobile-data-section current-section">
        <div class="section-title current">
          本次 2024-01-15 14:30:25
        </div>
        
        <!-- 通用流量进度条 -->
        <TrafficProgressBar
          title="通用流量"
          :used="40960"
          :remaining="36727.37"
          :total="77687.37"
          type="general"
          :icon="DataBoard"
        />
        
        <!-- 定向流量进度条 -->
        <TrafficProgressBar
          title="定向流量"
          :used="146381.24"
          :remaining="0"
          :total="146381.24"
          type="directed"
          :icon="TrendCharts"
        />
        
        <!-- 公免流量 -->
        <div class="public-free-card">
          <div class="public-free-header">
            <el-icon class="public-free-icon"><TrendCharts /></el-icon>
            <span class="public-free-title">公免流量</span>
          </div>
          <div class="public-free-value">5.14MB</div>
        </div>
      </div>

      <!-- 上次数据对比 -->
      <div class="mobile-data-section previous-section">
        <div class="section-title previous">
          上次 2024-01-15 14:00:15
        </div>
        
        <!-- 上次通用流量进度条 -->
        <TrafficProgressBar
          title="通用流量"
          :used="40832.13"
          :remaining="36855.24"
          :total="77687.37"
          type="general"
          :icon="DataBoard"
        />
        
        <!-- 上次定向流量进度条 -->
        <TrafficProgressBar
          title="定向流量"
          :used="145705.44"
          :remaining="0"
          :total="145705.44"
          type="directed"
          :icon="TrendCharts"
        />
        
        <!-- 上次公免流量 -->
        <div class="public-free-card">
          <div class="public-free-header">
            <el-icon class="public-free-icon"><TrendCharts /></el-icon>
            <span class="public-free-title">公免流量</span>
          </div>
          <div class="public-free-value">5.14MB</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { DataBoard, TrendCharts } from '@element-plus/icons-vue'
import TrafficProgressBar from '@/components/TrafficProgressBar.vue'
</script>

<style scoped>
.traffic-detail-demo {
  min-height: 100vh;
  background: #f8f9fa;
  padding: 20px;
}

.demo-header {
  text-align: center;
  margin-bottom: 30px;
  padding: 20px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.demo-header h1 {
  color: #333;
  margin-bottom: 10px;
  font-size: 28px;
  font-weight: 700;
}

.demo-header p {
  color: #666;
  font-size: 16px;
  margin: 0;
}

.demo-content {
  max-width: 800px;
  margin: 0 auto;
}

/* 移动端概览卡片 */
.mobile-overview-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.mobile-stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px 16px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid #f0f0f0;
}

.mobile-stat-value {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 4px;
  line-height: 1.2;
}

.mobile-stat-value.jump {
  color: #f56c6c;
}

.mobile-stat-value.free {
  color: #e6a23c;
}

.mobile-stat-label {
  font-size: 12px;
  color: #666;
  font-weight: 500;
}

.time-info-card {
  background: white;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.time-diff-info {
  font-size: 14px;
  color: #909399;
}

/* 移动端数据区域 */
.mobile-data-section {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.section-title {
  text-align: center;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #f0f0f0;
  font-size: 14px;
}

.section-title.current {
  color: #67c23a;
  border-bottom-color: #67c23a;
}

.section-title.previous {
  color: #409eff;
  border-bottom-color: #409eff;
}

/* 公免流量卡片样式 */
.public-free-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid #f0f0f0;
  transition: all 0.3s ease;
  margin-bottom: 20px;
  text-align: center;
}

.public-free-card:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.public-free-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.public-free-icon {
  font-size: 20px;
  color: #667eea;
}

.public-free-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.public-free-value {
  font-size: 24px;
  font-weight: 700;
  color: #667eea;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .traffic-detail-demo {
    padding: 12px;
  }
  
  .demo-header {
    padding: 16px;
    margin-bottom: 20px;
  }
  
  .demo-header h1 {
    font-size: 24px;
  }
  
  .demo-header p {
    font-size: 14px;
  }
  
  .mobile-overview-cards {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .mobile-stat-card {
    padding: 16px 12px;
  }
  
  .mobile-stat-value {
    font-size: 20px;
  }
  
  .public-free-card {
    padding: 20px;
  }
  
  .public-free-title {
    font-size: 16px;
  }
  
  .public-free-value {
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .traffic-detail-demo {
    padding: 8px;
  }
  
  .demo-header h1 {
    font-size: 20px;
  }
  
  .public-free-card {
    padding: 16px;
  }
  
  .public-free-header {
    flex-direction: column;
    gap: 4px;
  }
}
</style>
